<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});
//测试JWT
Route::any('/authenticate', 'AuthenticateController@authenticate');
//管理后台
Route::post('/login', 'Home\LoginController@login');

Route::post('auth/login', 'Auth\LoginController@login');

Route::get('/oopsoop', function(){
    return \CircularHelper\SendCircular('attendance_examined_agree',[1,2,3],['type' => '遗漏签到','time' => '9:00', 'status' => '已签到']);
});
//用户退出

Route::post('/register', 'Home\RegisterController@create');

Route::group(['prefix' => 'common','namespace' => 'Common', 'middleware' => 'token'], function()
{
    //通知接口
    Route::get('circular/read','CircularController@read');
    Route::get('circular/unread','CircularController@unread');
    Route::apiResource('circular', 'CircularController');
});


Route::group(['prefix' => 'home','namespace'=>'Home','middleware'=>'token'], function()

{


//	文件上传接口
	Route::post('/upload', 'UploadController@upload');

	Route::any('/login_out', 'LoginController@api_logout');
//	菜单管理
	Route::get('/menu_list','MenuController@lists');
//	获取用户信息
	Route::get('/profile','ManagerController@profile');

//	获取有效的用户列表
	Route::get('/user_list','ManagerController@user_list');
//	岗位配置
	Route::get('/test','IndexController@index');
	Route::get('/test2',function (){
		return Auth::user();
	});
	Route::any('/liststation', 'StationController@listStation');
	Route::any('/liststation_', 'StationController@listStation_');
	Route::post('/addstation', 'StationController@addStation');
	Route::post('/pubstation', 'StationController@pubStation');
	Route::any('/editstation/{id}', 'StationController@editstation');
	Route::post('/savestation', 'StationController@saveStation');
//	店铺配置
	Route::get('/liststore', 'StoreController@listStore');
	Route::post('/addstore', 'StoreController@addStore');
	Route::get('/editstore', 'StoreController@editStore');
	Route::post('/savestore', 'StoreController@saveStore');
	Route::any('/listsore_station', 'StoreController@listStore_station');
	Route::any('/listsore_station_', 'StoreController@listStore_station_');
	Route::post('/addstore_station', 'StoreController@addStore_station');
	Route::get('/editstore_station', 'StoreController@editStore_station');
	Route::post('/save_store_station', 'StoreController@save_store_station');

//	人员配置
	Route::get('/liststaff', 'StaffController@listStaff');
	Route::post('/addstaff', 'StaffController@addStaff');
	Route::post('/savestaff', 'StaffController@saveStaff');
	Route::any('/editstaff', 'StaffController@editStaff');

//	结算日期配置
	Route::get('/listaccount', 'AccountsController@listAccount');
	Route::post('/addaccount', 'AccountsController@addAccount');
	Route::post('/delaccount', 'AccountsController@delAccount');
	Route::post('/account/add', 'AccountsController@add');
	Route::get('/editaccount/{id}', 'AccountsController@edit');
	Route::post('/editsave_account', 'AccountsController@editsave_account');

//	角色管理
	Route::any('/role_list', 'ManagerController@role_list');
	Route::get('/editRole', 'ManagerController@editRole');
	Route::post('/saveRole', 'ManagerController@saveRole');
	Route::get('/Role/add', 'ManagerController@add_Role');
	Route::post('/addRole', 'ManagerController@addRole');
	Route::post('/edit_status', 'ManagerController@edit_status');
	Route::post('/assign_role', 'ManagerController@assign_role');
	Route::post('/add_permission', 'ManagerController@add_permission');
	Route::post('/role/permission', 'ManagerController@role_permission');
	Route::post('/role/permission/del', 'ManagerController@role_permission_del');
	Route::get('/permission_list', 'ManagerController@permission_list');
	Route::get('/role/configured', 'ManagerController@all_role_configured');
//	账号管理
	Route::get('/manager_list', 'ManagerController@manager_list');
	Route::post('/add_manager', 'ManagerController@add_manager');
	Route::get('/del_manager', 'ManagerController@del_manager');
	Route::get('/manage_role_list', 'ManagerController@manage_role_list');
	Route::get('/manage/role/list/no', 'ManagerController@manage_role_list_no');
	Route::post('/manage/role/del', 'ManagerController@manage_role_del');

//	部门管理
	Route::any('/department_list', 'SystermController@department_list');
	Route::any('/department_list_', 'SystermController@department_list_');
	Route::any('/department/lists', 'SystermController@departments');
	Route::get('/department_edit', 'SystermController@department_edit');
	Route::post('/department_save', 'SystermController@department_save');
	Route::post('/adddepartment', 'SystermController@addDepartment');

//	非门店部门配置
	Route::post('/no_store/station/add', 'SystermController@add_no_store_station');
	Route::get('/no_store/station/list', 'SystermController@no_store_station_list');
	Route::get('/no_store/station/edit', 'SystermController@edit_no_store_station');
	Route::post('/no_store/station/save', 'SystermController@save_no_store_station');
	Route::get('/no_store/station/list_', 'SystermController@no_store_station_list_');
//	审批流程管理
	Route::get('/list_approval', 'ApprovalController@list_approval');
	Route::get('/approval/roles', 'ApprovalController@roles');
	Route::get('/approval/edit', 'ApprovalController@edit');
	Route::post('/edit_approval', 'ApprovalController@edit_approval');
	Route::post('/add_approval', 'ApprovalController@add_approval');
	Route::post('/del_approval', 'ApprovalController@del_approval');
	Route::get('/approvel/type/list', 'ApprovalController@approvel_list');

//	业务组管理
	Route::any('/group_list', 'Business_groupController@group_list');
	Route::any('/save_group', 'Business_groupController@save_group');
	Route::any('/del_group', 'Business_groupController@del_group');
	Route::any('/group_edit', 'Business_groupController@group_edit');
	Route::any('/edit_save', 'Business_groupController@edit_save');
	Route::any('/add_group_member', 'Business_groupController@add_group_member');
	Route::any('/leader_list', 'Business_groupController@leader_list');
	Route::any('/leader_lists', 'Business_groupController@leader_lists');
	Route::any('/leader_lists_', 'Business_groupController@leader_lists_');
//	班次安排
	Route::get('/scheduling_list', 'SchedulingController@sch_list');
	Route::get('/scheduling/staff_date', 'SchedulingController@staff_date');
	Route::get('/edit_scheduling', 'SchedulingController@edit');
	Route::post('/scheduling/edit/save', 'SchedulingController@edit_save');
	Route::post('/add_Scheduling', 'SchedulingController@create');
	Route::get('/scheduling/staff/list', 'SchedulingController@scheduling_staff');
	Route::get('/scheduling/staff/list_', 'SchedulingController@scheduling_staff_');
	Route::post('/scheduling/classTime/add', 'SchedulingController@add_classTime');

//	结算操作
	Route::get('/settllist', 'SettlementController@lists');
	Route::post('/add_settle', 'SettlementController@add_settle');
	Route::post('/save_settle', 'SettlementController@save_settle');
	Route::get('/settle/desc', 'SettlementController@settle_desc');
	Route::post('/settle/edit/settle_hour', 'SettlementController@settle_hour');
	Route::get('/settle/xiafa/reward', 'SettlementController@xiafa_reward');
	Route::post('/settle/distribution/over', 'SettlementController@distribution_over');

//	公司管理
	Route::post('/company/add', 'CompanyController@add');
	Route::get('/company/lists', 'CompanyController@lists');
	Route::get('/company/edit', 'CompanyController@edit');
	Route::post('/company/save', 'CompanyController@save');
	Route::post('/company/status', 'CompanyController@status');
});


//移动管理端
Route::group(['prefix' => 'mobile','namespace'=>'Mobile','middleware'=>'token'], function()
{
	Route::get('/index', function (){echo 'Mobile';});
//	排班确认
	Route::get('/settle/index', 'SchedulController@index');
	Route::get('/settle/sch_desc', 'SchedulController@Sch_desc');
//	人员调动
	Route::get('/move/index', 'Staff_moveController@index');
	Route::post('/move/add', 'Staff_moveController@add_move');
	Route::get('/move/stores', 'Staff_moveController@all_store');
	Route::get('/move/staff', 'Staff_moveController@move_staff');
	Route::get('/move/stations', 'Staff_moveController@store_stations');


//	审批
	Route::get('/approval/leave/list/audited', 'ApprovalController@leave_list');
	Route::get('/approval/leave/list/audited_no', 'ApprovalController@leave_list_no');

	Route::get('/approval/move/list/audited', 'ApprovalController@move_list');
	Route::get('/approval/move/list/audited_no', 'ApprovalController@move_list_no');


	Route::get('/approval/stop/list/audited', 'ApprovalController@stop_list');
	Route::get('/approval/stop/list/audited_no', 'ApprovalController@stop_list_no');
	Route::post('/approval/leave/is_agree', 'ApprovalController@is_agree');

	Route::get('/approval/complaint/list/audited', 'ApprovalController@complaint');
	Route::get('/approval/complaint/list/audited_no', 'ApprovalController@complaint_no');


//	个人信息
	Route::get('/info/area', 'Personal_infoController@area');

//	数据报表
	Route::get('/report/index', 'Datareport_infoController@index');
	Route::get('/report/leave/index', 'Datareport_infoController@leavel_list');
	Route::get('/report/store', 'Datareport_infoController@store');
//	测试通知
	Route::get('/notice/test', 'IndexController@test');
});


//个人端

Route::post('/personal/register','Personal\IndexController@register');

Route::group(['prefix' => 'personal','namespace'=>'Personal','middleware'=>'token'], function()
{
//	接取任务
	Route::get('/task_list', 'TaskController@task_list');
	Route::get('/receipt_desc/{id}', 'TaskController@receipt_desc');
	Route::post('/receipt', 'TaskController@receipt');
	Route::post('/termination', 'TaskController@termination');
	Route::get('/termination/desc', 'TaskController@termination_desc');


//	签到
	Route::post('/sign/sign_start','SignController@sign_start');
	Route::get('/sign/appeal_list','SignController@appeal_list');
	Route::post('/sign/add_appeal','SignController@add_appeal');
	Route::post('/sign/sign_end','SignController@sign_end');
	Route::get('/sign/all_task','SignController@all_task');
	Route::get('/sign/sign_time','SignController@sign_time');


//	个人信息
	Route::get('/info/history/list','Personal_infoController@history_index');
	Route::get('/info/history/desc','Personal_infoController@history_desc');
	Route::get('/info/wallet/index','Personal_infoController@wallet_index');
//	Route::get('/info/history/desc','Personal_infoController@history_desc');


//	任务执行
	Route::get('/implement/index','ImplementController@task_index');
	Route::get('/implement/settle/index','ImplementController@settle_index');
	Route::get('/implement/settle/desc','ImplementController@settle_desc');
//	中止申请
	Route::get('/leave/index','LeaveController@index');
	Route::post('/leave/add','LeaveController@add_leave');
	Route::get('/leave/type','LeaveController@type_list');
	Route::get('/leave/task','LeaveController@leave_task');

//	终止结算
	Route::get('/leave/index','LeaveController@index');
});


//店长端
Route::post('/store_login', 'Home\LoginController@store_login');
Route::group(['prefix' => 'store','namespace'=>'Store','middleware'=>'token'], function()
{
	Route::get('/index', function (){echo 'Store';});
//	周插件
	Route::get('/week/plug', 'IndexController@week_plug');
	Route::get('/month/plug', 'IndexController@month_plug');
	Route::get('/mon/plug', 'IndexController@mon_plug');
	Route::get('/date/plug', 'IndexController@date_plug');
//	获取店铺所有的岗位
	Route::get('/allStation', 'TaskController@allStation');
//	店长端获取所有店铺岗位
	Route::get('/store_Station', 'TaskController@store_Station');
//	获取店铺岗位详情
	Route::get('/station_desc', 'TaskController@station_desc');
//	获取店铺岗位详情
	Route::get('/station_desc', 'TaskController@station_desc');
//	获取店铺岗位详情
	Route::get('/all_department', 'TaskController@all_department');
//	获取该店铺下所有的岗位
	Route::get('/all_store_station', 'TaskController@store_Station');
//	创建新任务
	Route::get('/add_task_all', 'TaskController@add_task_all');
	Route::get('/add_task', 'TaskController@add_task');
	Route::post('/save_task', 'TaskController@save_task');
	Route::post('/save_task_', 'TaskController@save_task_');

	Route::get('/task_list', 'TaskController@task_list');
	Route::get('/task_desc', 'TaskController@task_desc');
	Route::post('/update_task', 'TaskController@update_task');
	Route::post('/del_task', 'TaskController@del_task');


//	接单安排
	Route::get('/receipt_list', 'TaskController@receipt_list');
	Route::get('/receipt_desc/{id}', 'TaskController@receipt_desc');
	Route::post('/dispatchs', 'TaskController@dispatchs');
	Route::get('/implement_list', 'TaskController@implement_list');



//	终止任务
	Route::get('/level_list', 'TaskController@level_list');
	Route::get('/level_desc', 'TaskController@level_desc');
	Route::post('/approve_level', 'TaskController@approve_level');
	
//	任务结算
	Route::get('/settle/reward_index', 'SettleController@reward_index');
	Route::get('/settle/reward_lists', 'SettleController@reward_lists');
	Route::get('/settle/stop_list', 'SettleController@stop_list');
	Route::get('/settle/stop_desc', 'SettleController@stop_desc');
	Route::get('/settle/approve_stop', 'SettleController@approve_stop');
	Route::post('/settle/bonus_shares', 'SettleController@bonus_shares');
	Route::post('/settle/surplus', 'SettleController@surplus');
	Route::post('/settle/submit', 'SettleController@submit');
	Route::post('/settle/stop/approve', 'SettleController@stop_approve');
//	店铺信息
	Route::any('/info/index', 'Store_infoController@index');
	Route::any('/info/settle', 'Store_infoController@settle');
	Route::any('/info/settle_desc', 'Store_infoController@settle_desc');
	Route::any('/info/store_task', 'Store_infoController@store_task');
	Route::any('/info/history', 'Store_infoController@history_implement');
	Route::any('/info/sign', 'Store_infoController@sign');
	Route::any('info/leave_jl', 'Store_infoController@leave_jl');

//	排班
	Route::get('/sch/sch_add', 'SchedulController@sch_add');
	Route::post('/sch/sch_save', 'SchedulController@sch_save');
	Route::get('/sch/edit', 'SchedulController@edit');
	Route::post('/sch/edit_save', 'SchedulController@edit_save');


//	Route::any('/scheduling/sign', 'Store_infoController@sch_list');

});